<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="../../css/common/common.css" />
		<link rel="stylesheet" type="text/css" href="../../css/bookdetails/details.css" />
	</head>

	<body style="display: none;">
		<header class="mui-bar mui-bar-nav">
			<a id="homea" class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left "></a>
			<!--<a class="mui-pull-right share"><img src="../../imges/Group 811.png" /></a>-->
			<div class="mui-segmented-control">
				<a class="mui-control-item mui-active" href="#item1">详情</a>
				<a class="mui-control-item" href="#item2">导读</a>
				<a class="mui-control-item " href="#item3" id="threeTab">评价</a>
			</div>
		</header>
		<div class="mui-content">
			<iframe src="detail.html" class="iframe detail"></iframe>
			<iframe src="Introduction.html" class="iframe introduction"></iframe>
			<iframe src="evaluate.html" class="iframe evaluate"></iframe>
		</div>
		<script src="../../js/libs/zepto_1.1.3.js"></script>
		<script src="../../js/mui.min.js"></script>
		<script src="../../js/common/common.js"></script>
		<script type="text/javascript">
			mui.init();

			mui.plusReady(function() {
				$("iframe").height($(window).height() - 44)
				$(".mui-control-item").on("tap", function() {
					$(".iframe").eq($(this).index()).css("display", "block").siblings().css("display", "none")
				})
				$(document.body).css({
					"overflow-x": "hidden",
					"overflow-y": "hidden"
				});
				var self = plus.webview.currentWebview();
				var id = self.parameter;
				setTimeout(function() {
					$("body").show()
					document.getElementsByClassName("detail")[0].contentWindow.parent(id)
					document.getElementsByClassName("introduction")[0].contentWindow.parent(id)
					document.getElementsByClassName("evaluate")[0].contentWindow.parent(id)
					//					console.log(id)
					//		plus.webview.getWebviewById('detail.html').reload()

					/*$(".mui-control-item").on("tap", function() {
							if($(this).index() == 2) {
								return
							}
							document.getElementsByClassName("iframe")[$(this).index()].contentWindow.parent(id)
					})*/
				}, 300)
				//				plus.webview.create('detail.html', 'new', {'titleNView':{'backgroundcolor':'#FFFFFF','titletext':'标题栏','titlecolor':'#FF0000'}});

			})
			//自定义事件，模拟点击“首页选项卡”
			document.addEventListener('gohome', function() {
				location.reload();
				var threeTab = document.getElementById("threeTab");
				//模拟首页点击
				mui.trigger(threeTab, 'tap');
				//切换选项卡高亮
				mui - segmented - control
				var current = document.querySelector(".mui-segmented-control>.mui-control-item.mui-active");
				if(threeTab !== current) {
					current.classList.remove('mui-active');
					threeTab.classList.add('mui-active');
				}
			});

			document.addEventListener('goRecommended', function() {
				var item3 = document.getElementById("threeTab");
				//模拟首页点击
				mui.trigger(threeTab, 'tap');
				//切换选项卡高亮
				var current = document.querySelector(".mui-control-item>.mui-control-item.mui-active");
				if(threeTab !== current) {
					current.classList.remove('mui-active');
					threeTab.classList.add('mui-active');
				}
			});

			window.addEventListener('refresh', function(e) { //执行刷新
				document.getElementsByClassName("evaluate")[0].contentWindow.refresh()
			})

			$(document).on("tap", "#homea", function() {
				var load = plus.webview.getWebviewById("../reading/joinreading.html");
				mui.fire(load, "joinreading");
			})
		</script>
	</body>

</html>